package com.mazaiting.net

import android.content.BroadcastReceiver
import android.content.Context
import android.content.Intent
import android.util.Log

/**
 * 接收应用安装完成的广播
 * Created by mazaiting on 2018/7/17.
 */
class PackageReceiver : BroadcastReceiver() {
  val TAG = PackageReceiver::class.java.simpleName
  override fun onReceive(context: Context?, intent: Intent?) {
    val action = intent!!.action
    // 判断是否为新安装应用广播
    if (Intent.ACTION_PACKAGE_ADDED == action) {
      // 获取应用包名
      val packageName = intent.dataString.substring(8)
    }
  }
  
}